/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ejb;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Lella
 */
@Entity
@Table(name = "PISTA")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Pista.findAll", query = "SELECT p FROM Pista p"),
    @NamedQuery(name = "Pista.findById", query = "SELECT p FROM Pista p WHERE p.id = :id"),
    @NamedQuery(name = "Pista.findByNome", query = "SELECT p FROM Pista p WHERE p.nome = :nome"),
    @NamedQuery(name = "Pista.findByStato", query = "SELECT p FROM Pista p WHERE p.stato = :stato"),
    @NamedQuery(name = "Pista.findByDifficolta", query = "SELECT p FROM Pista p WHERE p.difficolta = :difficolta"),
    @NamedQuery(name = "Pista.findByComprensorio", query = "SELECT p FROM Pista p WHERE p.comprensorio = :comprensorio")})
public class Pista implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "NOME")
    private String nome;
    @Basic(optional = false)
    @NotNull
    @Column(name = "STATO")
    private short stato;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "DIFFICOLTA")
    private String difficolta;
    @Size(max = 20)
    @Column(name = "COMPRENSORIO")
    private String comprensorio;
    private String descrizione;

    public Pista() {
    }

    public Pista(Integer id) {
        this.id = id;
    }

    public Pista(Integer id, String nome, short stato, String difficolta, String descrizione) {
        this.id = id;
        this.nome = nome;
        this.stato = stato;
        this.difficolta = difficolta;
        this.descrizione =descrizione;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public short getStato() {
        return stato;
    }

    public void setStato(short stato) {
        this.stato = stato;
    }

    public String getDifficolta() {
        return difficolta;
    }

    public void setDifficolta(String difficolta) {
        this.difficolta = difficolta;
    }

    public String getComprensorio() {
        return comprensorio;
    }

    public void setComprensorio(String comprensorio) {
        this.comprensorio = comprensorio;
    }

    public String getDescrizione() {
        return descrizione;
    }

    public void setDescrizione(String descrizione) {
        this.descrizione = descrizione;
    }
    
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pista)) {
            return false;
        }
        Pista other = (Pista) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return getNome() + "," + getStato() + "," + getDifficolta() + "," + getDescrizione() + ";";
    }
    
}
